package cn.wolfcode.wolf2w.business.util;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {

    //获取传入时间当天最后一分一秒23:59:59
    public static Date getEndDate(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        calendar.set(Calendar.MINUTE, 59);
        calendar.set(Calendar.SECOND, 59);
        return calendar.getTime();
    }

    //获取两个时间间隔秒数
    public static long getDateBetween(Date startDate, Date endDate) {
        return Math.abs(startDate.getTime() - endDate.getTime()) / 1000;
    }

}
